home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / PACKAGE6 / MAXCARD.DOC < prev    next >
Text File  |  1990-07-25  |  2KB  |  44 lines

  1. -----------------------------------------------------------------------------
  2. ReadLnMaxCardinal
  3. -----------------------------------------------------------------------------
  4.  
  5. declaration:       procedure ReadLnMaxCardinal (var CardinalNumber:
  6.                                                       integer;
  7.                                                     MaxCardinal:
  8.                                                       integer;
  9.                                                 var LastKey:
  10.                                                       TypeKey);
  11.  
  12. purpose:           Reads in numbers allowing only 0..9, Escape, Enter,
  13.                    Backspace, and keeps a running tally of the number
  14.                    to prevent from exceeding MaxCardinal
  15.  
  16. precondition:      CardinalNumber is undefined, MaxCardinal is a positive
  17.                    integer, LastKey is undefined
  18.  
  19. postcondition:     CardinalNumber is set to 0 if Escape is pressed, and
  20.                    keeps value if Enter is pressed, CardinalNumber <=
  21.                    MaxCardinal
  22.  
  23. special cases:     none
  24.  
  25. example:           var Number:
  26.                          integer;
  27.                    var LastKey:
  28.                          TypeKey;
  29.  
  30.                    begin
  31.                      .
  32.                      .
  33.                      .
  34.                      write (output,'Enter a number from 1..10: ');
  35.                      ReadLnMaxCardinal (Number, 10, LastKey);
  36.                      if LastKey <> EscapeKey then
  37.                        write (output, Number);
  38.                      .
  39.                      .
  40.                      .
  41.                    end
  42.  
  43. -----------------------------------------------------------------------------
  44.